package com.suray.wcs.service.system.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.suray.basic.wcs.path.core.Lifter;
import com.suray.basic.wcs.path.core.Node;
import com.suray.basic.wcs.path.enums.NodeStatus;
import com.suray.basic.wcs.path.enums.NodeType;
import com.suray.basic.wcs.utils.Coord;
import com.suray.wcs.service.enums.PlusType;
import com.suray.wcs.service.enums.TaskType;
import com.suray.wcs.service.system.bo.ResourcesLockNodeBO;
import com.suray.wcs.service.system.bo.ResourcesNodeBO;
import com.suray.wcs.service.system.entity.NodeDB;
import com.suray.wcs.service.system.entity.TaskDB;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author cooper
 * @since 2019-06-26
 */
public interface INodeDBService extends IService<NodeDB> {

    List<NodeDB> getRegion(String xyz);

    List<Coord> findSpecifiedNodes(NodeType nodeType, NodeStatus nodeStatus, int floor);

    List<Coord> findSpecifiedNodes(List<NodeType> nodeTypeList, NodeStatus nodeStatus, int floor);

    List<Coord> findSpecifiedNodesByRoadType(NodeType nodeType, NodeStatus nodeStatus, int floor, String roadType);

    List<NodeDB> getNodeByFloor(Integer floor);

    List<NodeDB> getNodeDBList();

    Node getNodeByGroundCode(String groundCode);

    Set<Lifter> getLiftSet();


    List<NodeDB> getNodeDBByType();


    NodeDB getNodeDB(Coord coord);

    boolean updateNodeDBStatus(Coord coord, String gridStatus);

    boolean updateNodeDBRgv60Map(List<Node> nodes);

    boolean updateNodeDBBarCode(Coord coord, String gridStatus);

    Node getStartIsOutNodeForSingle(Node start);

    List<NodeDB> getNodeDBListBySingle(String singleNo, String singleOrder, String nodeStatus);

    void updateLifterLeftOrRightNodeDB(Coord coord, String gridStatus);

    NodeDB getNodeDBByGridID(String gridId);

    List<Node> getNodeListByFloor(Integer floor);

    List<Node> getNodeList();

    List<ResourcesLockNodeBO> getLockNodes(Integer floor);

    List<ResourcesNodeBO> getResourcesNodes(Integer floor);

    void unLockNode(Coord coord);

    List<NodeDB> getNodeDbNeedPrintCodeByX();

    List<NodeDB> getNodeDbNeedPrintCodeByY();

    List<Node> getNodeByType(NodeType nodeType);


    int getNodePUsedNum();

    NodeDB findByBarcode(String barcode);

    List<Node> getNodeByLayer(List<Integer> layers);

    List<NodeDB> getNodeDBByFloor(Integer floor);

    List<NodeDB> getNodeDBListByRoadNo(NodeDB node);

    List<Node> getNodeDBListByRoadNos(NodeDB node);

    List<NodeDB> getNodeDBListByRoadNo(String rodeNo, String direction);

    Set<Coord> getLinkedNode(Node node);

    void addPlusNode(Node node, Set<Node> lockSet, PlusType plusType, int lockCount);

    Set<Node> getLinkedNodeSet(Node node);

    Set<Node> getLinkedPlusNodeSet(Node node);

    void addPlusNode(Node node, Set<Node> lockSet, Set<Node> avoidPlusNodeSet, PlusType plusType, int lockCount);

    boolean checkPlusNodeDB(NodeDB plusNodeDB);

    boolean checkRemoveRoad(NodeDB plusNodeDB);

    List<NodeDB> getNodeDBsByGroundCode(String groundCode);

    boolean checkLifterLeftOrRightGridStatus(Coord coord, NodeStatus nodeStatus);

    Integer getMaxX();

    Integer getMaxY();

    Integer getMaxZ();

    List<NodeDB> selectNodeList(NodeDB nodeDB);

    /*检验传入节点是不是单开口巷道*/
    boolean isSingleRoad(NodeDB nodeDB);

    /*检验传入节点是不是单开口巷道*/
    boolean isDoubleRoad(NodeDB nodeDB);

    /* 得到巷道内全部的节点集合*/
    List<Node> getNodeListFromRoad(int x, int y, int z);

    /* 得到巷道内全部的节点集合*/
    List<Node> getNodeListFromRoad(String roadNo, String direction);

    List<NodeDB> getNodeDBByFloorAndType(String code, Integer layer);

    List<Node> getNodeDBListByRoadNoForOrder(Node node);


    void updateNodeDBByTask(TaskDB taskDB);

    int updateNodeDBInfo(NodeDB nodedb);

    int selectCountByStatus(NodeStatus nodeStatus);

    int selectCountByType(NodeType nodeType);

    Node getEndIsDeepNode(Node start, Node end, TaskType taskType);

    Node getNodeByRgvPoint(String rgv60Point);

    List<Node> findNodes(Set<Coord> nodeList);

    List<Node> findNodes(List<Node> coords);

    void updateBatchByTag(NodeDB nodeDB);
}
